package com.stackfarm.controller.AndroidController;

import com.stackfarm.fvcommon.requests.RangeReq;
import com.stackfarm.fvcommon.result.ResultBean;
import com.stackfarm.fvservice.service.warning.WarnService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/warnings")
@Api("查看警告信息")
public class WarningController {
    @Autowired
    WarnService warnService;

    @ApiOperation("设置预警的范围")
    @PostMapping("/setRange")
    public ResultBean<?> setRange( @Valid RangeReq rangeReq) {
        return warnService.setRange(rangeReq.getNo(), rangeReq.getType(), rangeReq.getMin(), rangeReq.getMax());
    }
}
